File_canRead1.htm
Complete Code;

import java.io.File;
import java.net.URI;

public class ClassTemplate1 {

public ClassTemplate1() {
// TODO Auto-generated constructor stub

}

public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
//C:\Eclipse_workspace\javaCore\Template1\Project1
File localFile = new File("C:" + File.separator + "Eclipse_workspace" +
File.separator + "javaCore"+File.separator +"Template1"+
File.separator +"Project1"+ File.separator ,"test.txt");
File homepage = new File(new URI("file:///BareBone_JavaCore/index.htm"));
System.out.println("Name :" +localFile.getName());
System.out.println(localFile.getPath());
//
System.out.println("------");
System.out.println("homepage canRead(): "+ homepage.canRead());
System.out.println("Name :"+ homepage.getName());
System.out.println("C:"+ homepage.getPath());
System.out.println("text file canRead(): "+ localFile.canRead());

}

}
 

Runtime View